<%@ page language="java" contentType="text/html; charset=utf-8"%>
<%@ include file="/WEB-INF/layouts/base.jsp"%>
<!DOCTYPE HTML>
<html>
<head>
<title>
	<c:if test="${empty menu}">创建菜单</c:if>
	<c:if test="${!empty menu }">修改菜单</c:if>
</title>
<script type="text/javascript" src="${basePath }/static/admin/main/js/add-menu.js"></script>
</head>
  <body class="gray-bg">
    <div class="wrapper add-member-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5><c:if test="${empty menu}">创建菜单</c:if><c:if test="${!empty menu}">修改角色信息</c:if> </h5>
                        <div class="ibox-tools">
                            <a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                            <a class="close-link"><i class="fa fa-times"></i></a>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <form id="menuform" class="form-horizontal">
                            <div class="form-group m-t">
                            	<label class="col-sm-2 control-label">菜单名称:</label>
								<div class="col-sm-4">
									<div class="input-icon right">
										<i class="fa"></i>
	                                	<input type="text" class="form-control" required name="menuName" value="${menu.menuName}"/>
                                	</div>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group m-t">
                            	<label class="col-sm-2 control-label">访问路径:</label>
								<div class="col-sm-4">
									<div class="input-icon right">
										<i class="fa"></i>
	                                	<input type="text" class="form-control" name="menuUrl" value="${menu.menuUrl}"/>
                                	</div>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group m-t">
                            	<label class="col-sm-2 control-label">图标:</label>
								<div class="col-sm-4">
									<div class="input-icon right">
										<i class="fa"></i>
	                                	<input type="text" class="form-control" name="menuIcon" value="${menu.menuIcon}"/>
                                	</div>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
						        <label class="col-sm-2 control-label">上级菜单:</label>
						        <div class="col-sm-4">
						        	<div class="input-icon right">
							        	<i class="fa"></i>
							        	<input type="hidden" id="parentId" name="parentId" value="${menu.parentId}"/>
							          	<input type="text" class="form-control" id="parentName" onclick="showMenu()" readonly
							          	value="${menu.parentMenu.menuName}" maxlength="20"/>
						        	</div>
						        </div>
						        <!-- <div class="col-md-2">
						        	<button type="button" class="btn btn-default" onclick="clearParentMenu()">清空</button>
						        </div> -->
						    </div>
						    <div class="hr-line-dashed"></div>
                            <div class="form-group m-t">
                            	<label class="col-sm-2 control-label">权限:</label>
								<div class="col-sm-4">
									<div class="input-icon right">
										<i class="fa"></i>
	                                	<input type="text" class="form-control" required name="perission" value="${menu.perission}"/>
                                	</div>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group m-t">
                            	<label class="col-sm-2 control-label">排序:</label>
								<div class="col-sm-4">
									<div class="input-icon right">
										<i class="fa"></i>
	                                	<input type="text" class="form-control" required name="sort" value="${menu.sort}"/>
                                	</div>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                           	<div class="form-group">
                                <div class="col-sm-4 col-sm-offset-2 add-submit">
                                <input type="hidden" class="form-control" name="id" value="${menu.id}" id="menuId">
                                <input class="btn btn-primary" type="button" id="menuSubmit" value="提交"/>
                                </div>
                           	</div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="modal fade" id="menuModal" tabindex="-1" role="basic" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
					<h4 class="modal-title">选择上级菜单</h4>
				</div>
				<div class="modal-body">
					 <ul id="menuTree" class="ztree" style="margin-top:0; width:160px;"></ul>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn blue" onclick="saveParentMenu()">确定</button>
					<button type="button" class="btn default" data-dismiss="modal">关闭</button>
				</div>
			</div>
		</div>
	</div>
</body>
</html>
